package com.codefox.service;

import java.util.List;

import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.codefox.entity.TbHospital;
import com.codefox.mapper.TbHospitalMapper;

/**
 * 医院服务层
 * 
 * @author puma
 * @date 2018年10月11日 上午9:11:59
 */
@Service
public class TbHospitalService {

	@Autowired
	SqlSessionFactory factory;

	/**
	 * 查询所有医院的信息
	 * 
	 * @return 所有医院信息的集合
	 */
	public List<TbHospital> listHospital() {
		try(SqlSession sqlSession = factory.openSession()){
			return sqlSession.getMapper(TbHospitalMapper.class).listHospital();
		}
	}

}
